#include <iostream>
using namespace std;
int main()
{
    int n1,aux;
    int suma=0;
    aux=0;
    cin>>n1;
    while(n1>aux)
    {
        suma=suma+n1;
        aux=n1;
        cin>>n1;
    }
    cout<<suma;

    return 1;
}
